package com.yimi.yinhepda.entity.bean;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Description PDA扫描交接跨越任务明细
 **/
public class KuaYueTaskDetailEntity {

    /**
     * 交接单号
     */
    private String taskNo;
    /**
     * 当前部门
     */
    private String deptCode;

    /**
     * 货物名称
     */
    private String goodsName;

    /**
     * 壹米运单号
     */
    private String waybillNo;

    /**
     * 壹米子单号
     */
    private String subWaybillNo;

    /**
     * 跨越运单号
     */
    private String outsideNo;

    /**
     * 跨越子单号
     */
    private String subOutsideNo;

    /**
     * 体积
     */
    private double volume;

    /**
     * 重量
     */
    private double weight;

    /**
     * 计费重量
     */
    private double chargedWeight;
    /**
     * 交接件数
     */
    private int pieceNum;

    /**
     * 操作类型：1-装车，2-卸车
     */
    private Integer operTypeCode;
    /**
     * 扫描人姓名
     **/
    private String operEmpName;
    /**
     * 扫描人姓名
     **/
    private String operEmpCode;
    /**
     * 扫描时间：yyyyMMddHHmmss
     */
    private String scanTime;
    // 装卸参与人
    private String operPersonCodes;
    // 装卸参与人姓名
    private String operPersonNames;
    //库区
    private String areaCode;
    //下一站编码
    private String nextDeptCode;
    //下一站名称
    private String nextDeptName;
    //输入方式 1-PDA扫描输入,2-手动输入，10-app（ios）
    private Integer inputType;
    //子单号集合
    private List<KuaYueChildWaybillEntitiy> childNos;

    /**
     * 2-强扫标志
     */
    private String remark;
    /**
     * 一级排序：红>黄>白>绿,getType
     */
    private int firstSort;
    /**
     * 托盘绑定：0-没有绑定数据，1-有绑定数据
     */
    private int isPalletBind;

    private boolean isCheck;

    /**
     * 多货统计
     */
    public int getMoreGoods() {
        int count = 0;
        for (KuaYueChildWaybillEntitiy item : childNos) {
            if (item.getWbType() == 1) {
                count++;
            }
        }
        return count;
    }

    /**
     * 少货统计
     */
    public int getLessGoods() {
        int count = 0;
        for (KuaYueChildWaybillEntitiy item : childNos) {
            if (item.getFlag() == 0) {
                count++;
            }
        }
        return count;
    }

    /**
     * 获得已扫数量
     */
    public int getScanCount() {
        if (childNos == null || childNos.isEmpty()) {
            return 0;
        }
        int count = 0;
        for (KuaYueChildWaybillEntitiy item : childNos) {
            if (item.getFlag() == 1) {
                count++;
            }
        }
        return count;
    }

    /**
     * 差异=扫描-交接
     */
    public int getDifference() {
        if ("2".equals(remark)) {
            return 1;
        } else {
            return getScanCount() - getPieceNum();
        }
    }

    public int getType() {
        int dif = getDifference();
        if (getScanCount() == 0) {
            //白色
            return 1;
        } else if (dif < 0) {
            //红色
            return 0;
        } else if (dif > 0) {
            //黄色
            return 2;
        } else {
            //绿色
            return 3;
        }
    }

    /**
     * 托盘绑定数
     */
    public int getPalletBindCount(){
        int count = 0;
        for (KuaYueChildWaybillEntitiy item : childNos) {
            if (item.getIsPalletBind() == 1) {
                count++;
            }
        }
        return count;
    }

    public String getDeptCode() {
        return deptCode;
    }

    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }

    public Integer getInputType() {
        return inputType;
    }

    public void setInputType(Integer inputType) {
        this.inputType = inputType;
    }

    public boolean isCheck() {
        return isCheck;
    }

    public void setCheck(boolean check) {
        isCheck = check;
    }

    public int getIsPalletBind() {
        return isPalletBind;
    }

    public void setIsPalletBind(int isPalletBind) {
        this.isPalletBind = isPalletBind;
    }

    public int getPieceNum() {
        return pieceNum;
    }

    public void setPieceNum(int pieceNum) {
        this.pieceNum = pieceNum;
    }

    public int getFirstSort() {
        return firstSort;
    }

    public void setFirstSort(int firstSort) {
        this.firstSort = firstSort;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getTaskNo() {
        return taskNo;
    }

    public void setTaskNo(String taskNo) {
        this.taskNo = taskNo;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getWaybillNo() {
        return waybillNo;
    }

    public void setWaybillNo(String waybillNo) {
        this.waybillNo = waybillNo;
    }

    public String getSubWaybillNo() {
        return subWaybillNo;
    }

    public void setSubWaybillNo(String subWaybillNo) {
        this.subWaybillNo = subWaybillNo;
    }

    public String getOutsideNo() {
        return outsideNo;
    }

    public void setOutsideNo(String outsideNo) {
        this.outsideNo = outsideNo;
    }

    public String getSubOutsideNo() {
        return subOutsideNo;
    }

    public void setSubOutsideNo(String subOutsideNo) {
        this.subOutsideNo = subOutsideNo;
    }

    public double getVolume() {
        return volume;
    }

    public void setVolume(double volume) {
        this.volume = volume;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    public double getChargedWeight() {
        return chargedWeight;
    }

    public void setChargedWeight(double chargedWeight) {
        this.chargedWeight = chargedWeight;
    }

    public Integer getOperTypeCode() {
        return operTypeCode;
    }

    public void setOperTypeCode(Integer operTypeCode) {
        this.operTypeCode = operTypeCode;
    }

    public String getOperEmpName() {
        return operEmpName;
    }

    public void setOperEmpName(String operEmpName) {
        this.operEmpName = operEmpName;
    }

    public String getOperEmpCode() {
        return operEmpCode;
    }

    public void setOperEmpCode(String operEmpCode) {
        this.operEmpCode = operEmpCode;
    }

    public String getScanTime() {
        return scanTime;
    }

    public void setScanTime(String scanTime) {
        this.scanTime = scanTime;
    }

    public String getOperPersonCodes() {
        return operPersonCodes;
    }

    public void setOperPersonCodes(String operPersonCodes) {
        this.operPersonCodes = operPersonCodes;
    }

    public String getOperPersonNames() {
        return operPersonNames;
    }

    public void setOperPersonNames(String operPersonNames) {
        this.operPersonNames = operPersonNames;
    }

    public String getAreaCode() {
        return areaCode;
    }

    public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }

    public String getNextDeptCode() {
        return nextDeptCode;
    }

    public void setNextDeptCode(String nextDeptCode) {
        this.nextDeptCode = nextDeptCode;
    }

    public String getNextDeptName() {
        return nextDeptName;
    }

    public void setNextDeptName(String nextDeptName) {
        this.nextDeptName = nextDeptName;
    }

    public List<KuaYueChildWaybillEntitiy> getChildNos() {
        return childNos;
    }

    public void setChildNos(List<KuaYueChildWaybillEntitiy> childNos) {
        this.childNos = childNos;
    }
}
